import  React from 'react'
import { BrowserRouter, Routes, Route , Navigate} from 'react-router-dom';

import Layout from '../components/Layout'
import Home from  '../views/Home'
import Login from '../views/Login';
import Patient from '../views/Patient';

const RouterView = ()=>{

    
    return (
        <BrowserRouter>
            <Routes>
                {/* frameIn 框架内的路由 */}
                <Route path='/' element={<Layout />}>
                    {/* 如果访问的根域名 我们就重定向到 /index首页 */}
                    <Route path=""  element={ <Navigate  to="/index" />}/>
                    <Route path='index' element={<Home /> } />
                    <Route path='patient' element={<Patient />} />
                </Route>
                {/* frameOut 独立的页面 */}
                <Route path='/login' element={ <Login /> } />
                {/* 缺省路由 */}
                <Route path="*" element={ <div>404</div> } />
            </Routes>
        </BrowserRouter> 
    )
}

export default RouterView